<style>
.jyui_cell_col .red {color: red;}
.fui-icon-group.col-7 .fui-icon-col {width: 14.28%;}
.signed {position: absolute;top:0;right:0.2rem;color:red;}
.fui-number .minus:before, .fui-number .plus:before {
	border-left: 0 solid #d9d9d9;
}
.fui-number .minus:after, .fui-number .plus:after {
	border-right: 0 solid #d9d9d9;
}
.fui-number:before {
	border-top: 0 solid #d9d9d9;
}
.fui-number:after {border-top: 0 solid #d9d9d9;}
.fui-number .num {
	color:#666;
}
.fui-number .num {
	color:#666;
}
.fui-number.small {
	height: 1.2rem;
	width: auto;
	line-height: 1.2rem;
}
.fui-number .minus, .fui-number .plus {
	z-index:0;
}
.fui-number.small .minus{
	color: {{main.syscolor || '#63BE72'}};
	padding-top:1px;
	border: 1px solid {{main.syscolor || '#63BE72'}};
	border-radius:50%;
}
 .fui-number.small .plus {
	color: #fff;
	padding-top:1px;
	background: {{main.syscolor || '#63BE72'}};
	border: 1px solid {{main.syscolor || '#63BE72'}};
	border-radius:50%;
}
.fui-icon-group .fui-icon-col {
    border: 0 dashed #ddd;
}
.fui-icon-group .fui-icon-col.big{
	height: 2.3rem;
    padding-top: 0;
	padding-bottom: 1rem;
}
.fui-icon-group .fui-icon-col.isgoods{border: 1px dashed #ddd;}
.fui-icon-group .fui-icon-col.noset{border: 1px dashed #18bc9c;}
.fui-icon-group .fui-icon-col.isset{border: 1px dashed red;}
</style>
<div class='fui-page fui-page-current' ng-if="pagedata.op=='main'">
    <div class='fui-content'>
		<div style="padding:0.5rem">
       <div class="tips tips-yellow" style="margin:0">
               <i class="fa fa-bullhorn"></i> 设置本订单的预约定期配送方式，如果不会设置，可以让配送员或者店员帮忙设置！
         </div>
		 <div class="tips tips-yellow" style="margin:0">
               <i class="fa fa-bullhorn"></i> 说明：已设置好的配送，修改配送设置需提前一天修改，提前一天最晚在【{{pagedata.gai_peihour}}】时间段前才能修改；
         </div>
		 <div class="tips tips-yellow" style="margin:0">
               <i class="fa fa-bullhorn"></i> 【停送说明】先点击停送再点击停送的日期，选择停送需在当天【{{pagedata.gai_peihour}}】点之前操作才能停送第二天至第N天的配送订单；
         </div>
		<div class="fui-cellone" style="text-align:left">
				<div class="fui-cellone-info bold">预约配送商品类型/数量</div>
				<div class="fui-cellone-remark noremark">
				</div>
		</div>
		<div class="fui-cell-group radius" style="padding:0 0.15rem">
				<div class="fui-icon-group col-3">
					<div class="fui-icon-col-sm">
						<div class="text bold">商品名称</div>
					</div>
					<div class="fui-icon-col-sm">
						<div class="text bold">商品现有数量</div>
					</div>
					<div class="fui-icon-col-sm">
						<div class="text bold">操作</div>
					</div>
				</div>
				<div ng-repeat="g in pagedata.allgoods" class="fui-icon-group col-3">
					<div class="fui-icon-col-sm">
						<div class="info" style="font-size:0.6rem">{{g.title}}</div>
						<div class="subtitle" style="font-size:0.6rem">规格：{{g.selespename || '无'}}</div>
					</div>
					<div class="fui-icon-col-sm">
						<div class="info bold">{{g.lastnum}}</div>
					</div>	
					 <div class="fui-icon-col-sm">
                        <div class="label label-success" style="font-size:0.7rem" ng-click="pagedata.nowgoods=g;pagedata.showsetnum=true"><i class="icon icon-qiehuan" style="font-size:0.7rem"></i> 设置</div>
                    </div>
                </div>
				<div class='content-empty' style="margin:0.5rem 0" ng-show="!pagedata.allgoods || pagedata.allgoods.length<=0">
						<i class='icon icon-information'></i><br/>暂时没有可设置的商品!
				</div>
				<!--<div class="btn btn-danger block btn-submit" style="margin:0.5;border-radius:1rem" ng-click="pagedata.upgoods();">提交数量规律设置</div>-->
		</div>
		<div class="fui-cellone" style="text-align:left">
				<div class="fui-cellone-info bold">每日配送数量预览表：</div>
				<div class="fui-cellone-remark noremark">
				<div class="jylabel jylabel-switch-label">
					<span ng-class="{'jylabel-switch':1,'active':pagedata.showstop}" ng-click="pagedata.showstop=true;">设置停送</span>
					<span ng-class="{'jylabel-switch':1,'active':!pagedata.showstop}" ng-click="pagedata.showstop=false;">关闭设置</span>
				</div>
				</div>
		</div>
		<div class="fui-cellone bold" style="padding:0;padding-bottom:0.3rem">
				<div ng-click="pagedata.upmonth(0);" class="fui-cellone-info" style="color:#18bc9c">
					<i class="icon icon-back" style="font-size:0.8rem"/>上月
				</div>
				<div class="fui-cellone-info c">
					{{pagedata.currentyear}}-{{pagedata.currentmonth}}
				</div>
				<div ng-click="pagedata.upmonth(1);" class="fui-cellone-info r" style="color:#18bc9c">
					下月<i class="icon icon-more" style="font-size:0.8rem"/>
				</div>
		</div>
		<div class="radius" style="background:#fff;padding-top:0.3rem;">
				<div class="fui-icon-group noborder col-7">
					<div class="fui-icon-col" ng-repeat="week in pagedata.params.work_weekarray" style="margin-top:0">
						<label class="jyui_cell_col big" style="color:#ddd">
							<div class="timetitle"><span>{{week.title}}</span></div>
						</label>
					</div>
				</div>
				<div class="fui-icon-group noborder col-7">
					<div class="fui-icon-col" ng-repeat="(k,value) in pagedata.kongday" style="margin-top:0">
						<label class="jyui_cell_col big">
							
						</label>
					</div>
					<div ng-if="!pagedata.showstop" ng-class="{'fui-icon-col big':1, 'isgoods':value.isgoods==1}" ng-repeat="(k,value) in pagedata.calendar" style="margin-top:0">
						<div ng-class="{'jyui_cell_col':1,'disabled':value.islast==1}">
							<div>
								<div>{{value.i}}</div>
								<div style="position:absolute;font-size:0.4rem;line-height:1;top:1rem;">
									<div style="max-height:1.25rem;overflow:hidden">
									<div ng-repeat="g in value.goods" ng-if="g.num>0">{{g.newtitle || g.title}} <span class="red">{{g.num}}</span></div>
									</div>
								</div>
							</div>
						</div>
					</div>
					<div ng-if="pagedata.showstop" ng-click="pagedata.setstopdays(value.day,value.isgoods);" ng-class="{'fui-icon-col big':1, 'noset':value.isgoods==1, 'isset':pagedata.peiset.stopdays.indexOf(';'+value.day+';')>=0}" ng-repeat="(k,value) in pagedata.calendar" style="margin-top:0">
						<div ng-class="{'jyui_cell_col':1,'disabled':value.islast==1}">
							<div>
								<div>{{value.i}}</div>
								<div style="position:absolute;font-size:0.4rem;line-height:1;top:1rem;">
									<div style="max-height:1.25rem;overflow:hidden">
									<div ng-repeat="g in value.goods" ng-if="g.num>0">{{g.newtitle || g.title}} <span class="red">{{g.num}}</span></div>
									</div>
								</div>
							</div>
						</div>
						<i ng-show="pagedata.peiset.stopdays.indexOf(';'+value.day+';')>=0" class="icon icon-selected bold signed" style="top:-0.6rem;right:0"></i>
					</div>
				</div>
				<div ng-if="pagedata.showstop && pagedata.peiset.stopdays" style="padding-bottom:0.5rem">
				<div class="btn btn-danger block btn-submit" style="margin:0.5rem;border-radius:1rem" ng-click="pagedata.upstop();">提交停送设置</div>
				</div>
		</div>
		<div class="fui-cellone" style="text-align:left">
				<div class="fui-cellone-info bold">预约配送时间段选择！</div>
				<div class="fui-cellone-remark noremark">
				<span class="btn btn-sm btn-success" style="background:#18bc9c;line-height:2" ng-click="pagedata.peiset.times='';">清空</span>
				</div>
		</div>
		<div class="radius" style="background:#fff">
			<div class="fui-cellone">
					<div class="fui-cellone-label" style="color:#18bc9c">早</div>
					<div class="fui-cellone-info"></div>
					<div class="fui-cellone-remark noremark" style="color:#18bc9c">预约早上时间</div>
				</div>
				<div class="fui-icon-group noborder col-3" style="padding:0 0.15rem">
					<div class="fui-icon-col" ng-repeat="item in pagedata.work_hours0" style="margin-top:0">
						<label class="jyui_cell_col" ng-click="pagedata.peiset.times=item.timev">
							<div ng-class="{'btn btn-gray':1,'red':pagedata.peiset.times==item.timev}" style="background:#f2f2f2;margin: 0.1rem;line-height:2">{{item.timev}}</div>
						</label>
						<i ng-show="pagedata.peiset.times==item.timev" class="icon icon-selected signed" style="top:0.3rem"></i>
					</div>
					<div class='content-empty' style="margin:0.5rem 0" ng-show="!pagedata.work_hours0 || pagedata.work_hours0.length<=0">
						暂时没有可设置的时间!
					</div>
				</div>
				<div class="fui-cellone">
					<div class="fui-cellone-label" style="color:#18bc9c">中</div>
					<div class="fui-cellone-info"></div>
					<div class="fui-cellone-remark noremark" style="color:#18bc9c">预约中午时间</div>
				</div>
				<div class="fui-icon-group noborder col-3" style="padding:0 0.15rem">
					<div class="fui-icon-col" ng-repeat="item in pagedata.work_hours1" style="margin-top:0">
						<label class="jyui_cell_col" ng-click="pagedata.peiset.times=item.timev">
							<div ng-class="{'btn btn-gray':1,'red':pagedata.peiset.times==item.timev}" style="background:#f2f2f2;margin: 0.1rem;line-height:2">{{item.timev}}</div>
						</label>
						<i ng-show="pagedata.peiset.times==item.timev" class="icon icon-selected signed" style="top:0.3rem"></i>
					</div>
					<div class='content-empty' style="margin:0.5rem 0" ng-show="!pagedata.work_hours1 || pagedata.work_hours1.length<=0">
						暂时没有可设置的时间!
					</div>
				</div>
				<div class="fui-cellone">
					<div class="fui-cellone-label" style="color:#18bc9c">晚</div>
					<div class="fui-cellone-info"></div>
					<div class="fui-cellone-remark noremark" style="color:#18bc9c">预约晚上时间</div>
				</div>
				<div class="fui-icon-group noborder col-3" style="padding:0 0.3rem">
					<div class="fui-icon-col" ng-repeat="item in pagedata.work_hours2" style="margin-top:0">
						<label class="jyui_cell_col" ng-click="pagedata.peiset.times=item.timev">
							<div ng-class="{'btn btn-gray':1,'red':pagedata.peiset.times==item.timev}" style="background:#f2f2f2;margin: 0.1rem;line-height:2">{{item.timev}}</div>
						</label>
						<i ng-show="pagedata.peiset.times==item.timev" class="icon icon-selected signed" style="top:0.3rem"></i>
					</div>
					<div class='content-empty' style="margin:0.5rem 0" ng-show="!pagedata.work_hours2 || pagedata.work_hours2.length<=0">
						暂时没有可设置的时间!
					</div>
				</div>
		</div>
		<div class="fui-cellone" style="text-align:left">
				<div class="fui-cellone-info bold">配送地址设置</div>
				<div class="fui-cellone-remark noremark">
					<div class="jylabel jylabel-switch-label">
								<span ng-class="{'jylabel-switch':1,'active':pagedata.peiset.address.isopen==1}" ng-click="pagedata.peiset.address.isopen=1;">使用新地址</span>
								<span ng-class="{'jylabel-switch':1,'active':pagedata.peiset.address.isopen!=1}" ng-click="pagedata.peiset.address.isopen=0;">使用默认地址</span>
					</div>
				</div>
		</div>
		<div class="radius" style="background:#fff">
			<div class="fui-cellone">
				<div class="fui-cellone-label" style="color:#18bc9c;width:auto;padding-right:0.5rem">默认地址</div>
				<div class="fui-cellone-info">
					<div class="title"><span class='realname'>{{pagedata.address.name}}</span> <span class='mobile'>{{pagedata.address.mobile}}</span></div>
					<div class="text"><span class='address'>{{pagedata.address.pcd.province}}&nbsp{{pagedata.address.pcd.city}}&nbsp{{pagedata.address.pcd.district}}&nbsp{{pagedata.address.pcd.street}}&nbsp{{pagedata.address.address}}</span></div>
				</div>
			</div>
			<div ng-if="pagedata.peiset.address" class="fui-cellone">
				<div class="fui-cellone-label" style="color:#18bc9c;width:auto;padding-right:0.5rem">新地址</div>
				<div class="fui-cellone-info">
					<div class="title"><span class='realname'>{{pagedata.peiset.address.name}}</span> <span class='mobile'>{{pagedata.peiset.address.mobile}}</span></div>
					<div class="text"><span class='address'>{{pagedata.peiset.address.pcd.province}}&nbsp{{pagedata.peiset.address.pcd.city}}&nbsp{{pagedata.peiset.address.pcd.district}}&nbsp{{pagedata.peiset.address.pcd.street}}&nbsp{{pagedata.peiset.address.address}}</span></div>
				</div>
				<div class="fui-cellone-remark" ng-click="pagedata.edit_address=true;">
					编辑
				</div>
			</div>
			<div ng-if="!pagedata.peiset.address" class="c">
				<div ng-click="pagedata.edit_address=true;" class='btn btn-sm btn-danger-o external' style="border-radius: 100px;width:  7rem;font-size: .75rem"><i class="icon icon-tianjia"></i> 添加配送地址</div>
			</div>
			<div class="gray" style="padding:0 0.5rem">备注：修改配送地址需咨询商家是否支持这个配送范围；</div>
		</div>
        <div class="fui-cell-group">
                <div class="fui-cell small ">
                    <div class="fui-cell-info">
                        <label class="checkbox-inline">
                            <input type="checkbox" class="fui fui-checkbox fui-checkbox-danger" ng-checked="pagedata.peiset.agree==1" ng-model="pagedata.peiset.agree" /> 我已经阅读并了解了<a id="btn-apply" ng-click="pagedata.show_content=true" style="color:#337ab7;">【{{pagedata.yuyuexieyi.title}}】</a>。
                        </label>

                    </div>
                </div>
         </div>
         <div ng-show="pagedata.show_content" class="modal-bg pop-apply-hidden" >
                <div class="modal-content" style="top:10%;width:90%;left:5%">
                    <div class="closebtn" ng-click="pagedata.show_content=false" style="opacity:1;"><i class="icon icon-cuowu"></i></div>
                    <div class="news-body">
						<div class="title">{{pagedata.yuyuexieyi.title}} / <small>Read &nbsp;Ggree</small></div>
                        <div class="text" ng-bind-html="trust(pagedata.yuyuexieyi.content)"></div>
                    </div>
					<div class="modal-footer">
                            <div ng-click="pagedata.peiset.agree=1;pagedata.show_content=false" class="mod-check" style="width: 100%; margin: 0;">我已阅读</div>
                    </div>
                </div>
         </div>
        <div class='btn btn-danger block btn-submit' style="margin-top:1rem" ng-click="post(pagedata.peiset,'jy_peimilk/setpei/post/')">提交设置</div>
		 </div>
		</div>
</div>
<div ng-if="pagedata.showsetnum" class="popup">
	<div class="popup-body">
		<div class="popup-bottom" style="min-height:auto">
			<i class="closed icon icon-cuowu" style="top:-2.3rem" ng-click="pagedata.showsetnum=false"></i>
			<div class="fui-cellone" style="text-align:left">
				<div class="fui-cellone-info bold">按星期设置[{{pagedata.nowgoods.title}}]配送数量规律：</div>
				<div class="fui-cellone-remark noremark" ng-click="pagedata.showsetnum=false;pagedata.upgoods();" style="color:#18bc9c">确定</div>
			</div>
			<div class="radius" style="background:#fff;padding:1rem 0;max-height:20rem;overflow-y:scroll">
				<div ng-repeat="item in pagedata.nowgoods.numset" style="border-bottom: 1px solid #f2f2f2;">
				<div class="fui-cellone" style="padding:0.3rem 0.5rem">
					<div class="fui-cellone-info bold red">{{item.title}}：</div>
				</div>
				<div class="fui-icon-group noborder col-7">
					<div class="fui-icon-col" ng-repeat="week in pagedata.params.work_weekarray" style="margin-top:0">
						<label class="jyui_cell_col" style="color:#ddd">
							<div class="timetitle"><span>{{week.title}}</span></div>
						</label>
					</div>
				</div>
				<div class="fui-icon-group noborder col-7">
					<div class="fui-icon-col" ng-repeat="v in item.data" style="margin-top:0">
						<div class="weui_cell">
							<input ng-if="pagedata.params.work_weekarray[$index].isno!=1" type="text" class="weui_input" style="text-align:center;" placeholder="数量" ng-model="v.num"/>
							<span class="weui_input c red" ng-if="pagedata.params.work_weekarray[$index].isno==1">休息</span>
						</div>
					</div>
				</div>
				</div>
			</div>
		</div>
	</div>
</div>
<div ng-if="pagedata.edit_address" class="popup">
	<div class="popup-body">
		<div class="popup-center">
			<div class='fui-cell-group modal-swiper-y' style="border-radius: 0.5rem;margin-top:0;height:auto;max-height:20rem;padding-bottom:2.5rem">
				<div class="fui-cell">
					<div class="fui-cell-label" style="width:100px;font-size:0.8rem">编辑地址</div>
					<div class='fui-cell-info'></div>
					<div class="fui-cell-remark" ng-if="pagedata.openid"><span ng-click="pagedata.openAddress()">添加微信地址</span></div>
				</div>
                <div class='fui-cell'>
                    <div class='fui-cell-label'>收件人</div>
                    <div class='fui-cell-info'><input type="text" ng-model="pagedata.peiset.address.name" placeholder="收件人" class="fui-input"/></div>
                </div>
                <div class='fui-cell'>
                    <div class='fui-cell-label'>联系电话</div>
                    <div class='fui-cell-info'><input type="tel" ng-model="pagedata.peiset.address.mobile" placeholder="联系电话"  class="fui-input"/></div>
                </div>
                <div class="fui-cell">
					<div class="fui-cell-label ">地区</div>
					<div class="fui-cell-label" style="width:28%">
						<select ng-model="pagedata.peiset.address.pcd.province" class="form-control tpl-province">
						<option value="" selected="selected">省份</option>
						<option ng-repeat="(value,data) in pagedata.province" value="{{value}}" ng-selected="pagedata.peiset.address.pcd.province==value">{{value}}</option>
						</select>
					</div>
					<div class="fui-cell-label" style="width:28%">
						<select ng-model="pagedata.peiset.address.pcd.city" class="form-control tpl-city">
						<option value="" selected="selected">城市</option>
						<option ng-repeat="(value,data) in pagedata.province[pagedata.peiset.address.pcd.province]" value="{{value}}" ng-selected="pagedata.peiset.address.pcd.city==value">{{value}}</option>
						</select>
					</div>
					<div class="fui-cell-label" style="width:28%">
						<select ng-model="pagedata.peiset.address.pcd.district" class="form-control tpl-district">
						<option value="" selected="selected">区县</option>
						<option ng-repeat="(value,data) in pagedata.province[pagedata.peiset.address.pcd.province][pagedata.peiset.address.pcd.city]" value="{{value}}" ng-selected="pagedata.peiset.address.pcd.district==value">{{value}}</option>
						</select>
					</div>
					<div class="fui-cell-label" style="width:28%">
						<select ng-model="pagedata.peiset.address.pcd.street" class="form-control tpl-district">
						<option value="" selected="selected">街道</option>
						<option ng-repeat="value in pagedata.province[pagedata.peiset.address.pcd.province][pagedata.peiset.address.pcd.city][pagedata.peiset.address.pcd.district]" value="{{value}}" ng-selected="pagedata.peiset.address.pcd.street==value">{{value}}</option>
						</select>
					</div>
				</div>
                <div class='fui-cell'>
                    <div class='fui-cell-label'>详细地址</div>
                    <div class='fui-cell-info'><input type="text" ng-model="pagedata.peiset.address.address" placeholder='街道，楼牌号等'  class="fui-input"/></div>
                </div>
            </div>
			<div class="fui-navbar">
				<a href="javascript:;" ng-click="pagedata.edit_address=false" class="nav-item btn btn-danger confirmbtn">确定</a>
			</div>
			<i ng-click="pagedata.edit_address=false" class="closed icon icon-cuowu"></i>
		</div>
	</div>
</div>
<script language='javascript'>
scope.pagedata.gotoshowtime=function(){
	scope.get('jy_peimilk/setpei/get_work_time/',function(res){
		scope.pagedata.work_hours0=res.hours0;
		scope.pagedata.work_hours1=res.hours1;
		scope.pagedata.work_hours2=res.hours2;
		scope.$evalAsync();
	});
}
scope.pagedata.gotoshowtime();
scope.pagedata.getDates=function(){
	scope.get('jy_peimilk/setpei/time_days/year='+scope.pagedata.currentyear+'&month='+scope.pagedata.currentmonth,function(res){
		console.log(scope.pagedata.currentyear);
		scope.pagedata.kongday=res.kongday;
		scope.pagedata.calendar=res.calendar;
		scope.$evalAsync()
		return true;
	});
}
scope.pagedata.getDates();
scope.pagedata.upmonth=function(isadd){
	var currentmonth=parseInt(scope.pagedata.currentmonth);
	if(isadd==1){
		if(currentmonth==12){
			currentmonth=1
			scope.pagedata.currentyear++
		}else{
			currentmonth++
		}
	}
	if(isadd!=1){
		if(currentmonth==1){
			currentmonth=12
			scope.pagedata.currentyear--
		}else{
			currentmonth--
		}
	}
	if(currentmonth<10){
		scope.pagedata.currentmonth='0'+currentmonth
	}else{
		scope.pagedata.currentmonth=currentmonth
	}
	scope.pagedata.getDates();
	return true;
}
scope.pagedata.upall=function(){
	var calendar = Object.values(scope.pagedata.calendar)
	for(var i=0;i<calendar.length;i++){
		var value=calendar[i]
		scope.duoxuans(value,scope.pagedata.peiset,'days')
	}
	scope.$evalAsync();
}
//减少
scope.pagedata.minus=function(g){
	scope.pagedata.peiset.goods[g.goodsid]=scope.pagedata.peiset.goods[g.goodsid]?scope.pagedata.peiset.goods[g.goodsid]:{'num':0,'title':g.goods_title,'goodsid':g.goodsid}
	if(scope.pagedata.peiset.goods[g.goodsid].num<=0){
		return false;
	}
	scope.pagedata.peiset.goods[g.goodsid].num--
}
//增加
scope.pagedata.plus=function(g){
	scope.pagedata.peiset.goods[g.goodsid]=scope.pagedata.peiset.goods[g.goodsid]?scope.pagedata.peiset.goods[g.goodsid]:{'num':0,'title':g.goods_title,'goodsid':g.goodsid}
	if(scope.pagedata.peiset.goods[g.goodsid].num>=g.lastnum){
		scope.message('不能再添加了，已超过剩余商品数量！','error');
		return false;
	}
	scope.pagedata.peiset.goods[g.goodsid].num++
}
//减少
scope.pagedata.minus2=function(g,k){
	scope.pagedata.peiset.goods[g.goodsid+'_'+k]=scope.pagedata.peiset.goods[g.goodsid+'_'+k]?scope.pagedata.peiset.goods[g.goodsid+'_'+k]:{'num':0,'title':g.goods_title,'goodsid':g.goodsid}
	scope.pagedata.peiset.goods[g.goodsid+'_'+k].title=g.goods_title
	scope.pagedata.peiset.goods[g.goodsid+'_'+k].ktitle=g.leixings[k].title
	if(scope.pagedata.peiset.goods[g.goodsid+'_'+k].num<=0){
		return false;
	}
	scope.pagedata.peiset.goods[g.goodsid+'_'+k].num--
}
//增加
scope.pagedata.plus2=function(g,k){
	scope.pagedata.peiset.goods[g.goodsid+'_'+k]=scope.pagedata.peiset.goods[g.goodsid+'_'+k]?scope.pagedata.peiset.goods[g.goodsid+'_'+k]:{'num':0,'title':g.goods_title,'goodsid':g.goodsid}
	scope.pagedata.peiset.goods[g.goodsid+'_'+k].goodsid=g.goodsid
	scope.pagedata.peiset.goods[g.goodsid+'_'+k].title=g.goods_title
	scope.pagedata.peiset.goods[g.goodsid+'_'+k].ktitle=g.leixings[k].title
	var isnum=0;
	for(var i=0;i<g.leixings.length;i++){
		scope.pagedata.peiset.goods[g.goodsid+'_'+i]=scope.pagedata.peiset.goods[g.goodsid+'_'+i]?scope.pagedata.peiset.goods[g.goodsid+'_'+i]:0;
		isnum=isnum+scope.pagedata.peiset.goods[g.goodsid+'_'+i].num
	}
	if(isnum>=g.lastnum){
		scope.message('不能再添加了，已超过剩余商品数量'+g.lastnum+'！','error');
		return false;
	}
	scope.pagedata.peiset.goods[g.goodsid+'_'+k].num++
}
scope.pagedata.getprovince=function(){
	scope.get('core/member.set/getprovince/',function(res){
		scope.pagedata.province=res.province;
		scope.$evalAsync();
	});
}
scope.pagedata.getprovince();
scope.pagedata.upgoods=function(){
	scope.post_json('jy_peimilk/setpei/postgoods/',scope.pagedata.nowgoods,function(res){
		scope.pagedata.getDates();
		//scope.message('刷新数量成功！');
		return true;
	});
}
scope.pagedata.upstop=function(){
	scope.post_json('jy_peimilk/setpei/upstop/',scope.pagedata.peiset,function(res){
		scope.pagedata.peiset.stopdays='';
		scope.pagedata.showstop=false;
		scope.pagedata.getDates();
		//scope.message('刷新数量成功！');
		return true;
	});
}
scope.pagedata.setstopdays=function(day,set){
	if(set==1){
		scope.duoxuans(day,scope.pagedata.peiset,'stopdays');
		scope.$evalAsync();
	}
}
</script>